<%@page import="ll.sms.web.*,java.util.*"%><%@ page language="java" import="ll.sms.pojo.*" pageEncoding="UTF-8"%>
<%@page import="ll.sms.util.*"%>
<%
String currentUsername = SmsUtil.sessionHelper(session,AdminProperty.auname);
if(!"admin".equals(currentUsername)){
	return;
}
String cmd = request.getParameter("cmd");
String proxyname = request.getParameter("proxyname");

//proxyname = proxyname==null?"":new String(proxyname.getBytes("ISO-8859-1"),"GBK");

if("getlist".equals(cmd)){
//取得列表
List<ProxyChannels> list = WebBusinessImpl.getInstance().allProxyChannelList(proxyname);
System.out.println(ExtJsonBuilder.toExtJsonString(list==null?0:list.size(),list));
out.print(ExtJsonBuilder.toExtJsonString(list==null?0:list.size(),list));
return;
}

if("doproxychange".equals(cmd)){
String channel = request.getParameter("channel");
String tochannel = request.getParameter("tochannel");
String proxyid = request.getParameter("proxyid");
if(proxyid==null || proxyid.trim().equals("") || proxyid.length()!=32){
 out.print( "{success:false,errors:{msg:'通道ID错误'}}");
 return;
}
if(channel==null || tochannel==null || channel.equals(tochannel) ){
 out.print( "{success:false,errors:{msg:'通道选择错误'}}");
 return;
}
out.print(WebBusinessImpl.getInstance().channelChange(proxyid,channel,tochannel));
return;
}

if("doallproxychange".equals(cmd)){
String channel = request.getParameter("channel");
String tochannel = request.getParameter("tochannel");
if(channel==null || tochannel==null || channel.equals(tochannel) ){
 out.print( "{success:false,errors:{msg:'通道选择错误'}}");
 return;
}
out.print(WebBusinessImpl.getInstance().channelChange(null,channel,tochannel));
	return;
}
%>
